package com.neo.unittest.controller;

import com.neo.unittest.entity.User;
import com.neo.unittest.service.RemoteService;
import com.neo.unittest.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
public class TestController {

    @Autowired
    private UserService userService;


    @Autowired
    private RemoteService remoteService;


    @GetMapping("local/user/{id}")
    public User user(@PathVariable("id") Long id) {
        return userService.getById(id);
    }

    @GetMapping("remote/search/{name}")
    public String search(@PathVariable("name") String name) {
        return remoteService.search(name);
    }


}
